<template>
  <div>
    <h4>欢迎光临 vue开发的收银系统水果店</h4>
    <h5>苹果10￥/斤，折扣 < 8折 > </h5>
    <h4>请输入你要购买的斤数 <input type="text" v-model="msg"></h4>
    <button @click="pay">结账买单~</button>
    <h4>结账单：总价 {{totalMoney}}￥ 折后价{{discountMoney}}￥ 省了{{freeMoney}}￥</h4>
  </div>
</template>

<script>
export default {
  data(){
    return{
      msg:0,
      totalMoney:0,
      discount:0,
      freeMoney:0,
    }
  },
  methods:{
    pay(){
      this.totalMoney=(this.msg*10)
      this.discountMoney=(this.msg*10)*.8
      this.freeMoney=this.totalMoney-this.discountMoney
    }
  }
}
</script>

<style scoped>

</style>>

</style>